docs: describe limit/page query params for events API pagination - #4901
Open
SteveGilvarry wants to merge 1 commit into
Open
docs: describe limit/page query params for events API pagination#4901SteveGilvarry wants to merge 1 commit into
SteveGilvarry wants to merge 1 commit into
Conversation
…oneMinder#3106 The API docs claimed events.json defaults to 25 entries per page tied to WEB_EVENTS_PER_PAGE. The API actually returns the full list unless limit and/or page query parameters are supplied, and WEB_EVENTS_PER_PAGE only affects the web event list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the ZoneMinder API documentation to correctly describe how pagination works for the events.json endpoint, aligning the docs with the actual behavior in EventsController (pagination only occurs when limit and/or page query parameters are provided).
Changes:
- Corrects the pagination description for
GET /api/events.jsonto reflect opt-in pagination vialimit/pagequery params (and clarifiesWEB_EVENTS_PER_PAGEis web-UI only). - Updates the pagination iteration example to include
limitin the query string.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+328
to
+331
| Note that the events list can be quite large. Without any parameters this endpoint | ||
| returns the full, unpaginated list. To paginate, pass ``limit`` (entries per page) | ||
| and/or ``page`` query parameters; supplying either enables pagination. The | ||
| WEB_EVENTS_PER_PAGE option only affects the web event list, not the API. |
Comment on lines
+338
to
345
| data = http://server/zm/api/events.json?limit=100&page=1 # this returns the first page | ||
| # The json object returned now has a property called data.pagination.pageCount | ||
| count = data.pagination.pageCount; | ||
| for (i=1, i<count, i++) | ||
| { | ||
| data = http://server/zm/api/events.json?page=i; | ||
| data = http://server/zm/api/events.json?limit=100&page=i; | ||
| doStuff(data); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The API docs claimed events.json defaults to 25 entries per page tied to WEB_EVENTS_PER_PAGE. The API actually returns the full, unpaginated list unless
limitand/orpagequery parameters are supplied, and WEB_EVENTS_PER_PAGE only affects the web event list (see EventsController — pagination engages on request params; the web-option coupling was deliberately removed).Updates the pagination paragraph and the iteration pseudocode accordingly.
refs #3106
🤖 Generated with Claude Code